package com.ruima.framework.rest;

import java.sql.SQLException;

import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;

import com.ruima.framework.db.impl.RmAppShishicaiImpl;
import com.ruima.framework.db.impl.RmSysUserImpl;

import net.sf.json.JSONArray;
import net.sf.json.JsonConfig;

@Path("RmAppShishicaiService")
public class RmAppShishicaiService {

	private static String APP_SHISHICAI_JSON;
	private RmAppShishicaiImpl rmAppShishicaiImpl = new RmAppShishicaiImpl();
	@GET
	@Produces(MediaType.TEXT_HTML)
	@Path("getrmappshishicailist")
	public String getRmAppShishicaiList(){
		try {
			if(APP_SHISHICAI_JSON==null){
				JsonConfig jc = new JsonConfig();
				jc.setExcludes(new String[]{});
				APP_SHISHICAI_JSON = JSONArray.fromObject(rmAppShishicaiImpl.getRmAppShishicais(),jc).toString();
			}
			return "{\"identifier\":\"objid\",\"label\":\"objid\",\"items\":"+APP_SHISHICAI_JSON+"}";
		} catch (SQLException e) {
			e.printStackTrace();
		}
		return "{\"result\":0}";
	}
}
